//****************************************//
//****************************************//

using TomShane.Neoforce.Controls;
using Microsoft.Xna.Framework;
namespace NOWAOnline.Scenes.LoginScene
{
sealed class SelectServer : Window
{
    public Panel list;
    public ServerItem _currentSelect;
    public Button ServerOk;
    public Button ServerCancel;
public SelectServer(Manager manager)
 : base(manager)
{
this.Width = 418;
this.Height = 447;
    list = new Panel(manager);
    list.Parent = this;
    list.Top = 0;
    list.Left = 0;
    list.Width = this.Width-14;
    list.Height = this.Height-90;
    list.AutoScroll = true;
    list.Resizable = false;
    list.Color = this.ClientArea.Color;
    list.BackColor = this.ClientArea.BackColor;
    list.Init();
    ServerOk = new Button(manager);
    this.ServerOk.Text = "Ok";
    ServerOk.Init();
    ServerOk.Left = this.Width/2-110+1;
    ServerOk.Top = this.Height-60;
    ServerOk.Width = 105;
    ServerOk.Height = 20;
    ServerOk.Parent = this;

    ServerCancel = new Button(manager);
    this.ServerCancel.Text = "Cancel";
    ServerCancel.Init();
    ServerCancel.Left = this.Width / 2 +6;
    ServerCancel.Top = this.Height - 60;
    ServerCancel.Width = 105;
    ServerCancel.Height = 20;
    ServerCancel.Parent = this;
this.Text = "Select server";
this.AutoScroll = false;
this.Resizable = false;
this.CloseButtonVisible = false;

}

public void AddInList(Control control)
{
    if (control.GetType()==typeof(ServerItem))
    {
        
   
    if (_currentSelect==null )
    {
        _currentSelect = (ServerItem)control;
        _currentSelect.setColor(Microsoft.Xna.Framework.Color.Gray);
        Refresh();
    }
    control.Click += new EventHandler(control_Click);
    list.Add(control);
    }
}

void control_Click(object sender, EventArgs e)
{
    _currentSelect.setColor( _currentSelect.DefColor);
    _currentSelect = (ServerItem)sender;

    _currentSelect.setColor( Microsoft.Xna.Framework.Color.Gray);
   
    Refresh();
}
}
}
